package org.abacus.client.common;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

public final class ExitHelper {
	private static boolean exit = false;

	private ExitHelper() {
		super();
	}

	public synchronized static boolean isExit() {
		return exit;
	}

	public synchronized static void setExit(boolean exit) {
		ExitHelper.exit = exit;
	}

	public static final DisposeListener disposeListener = new DisposeListener() {
		@Override
		public void widgetDisposed(DisposeEvent arg0) {
			if (arg0.display.getShells().length <= 1) {
				ExitHelper.setExit(true);
			}
		}
	};
}
